﻿using System;
using Avalonia.Media.Imaging;
using Avalonia.Platform;
using AvaloniaEdit.Document;
using AvaloniaEdit.Editing;
using MarkdownRow.Assets;

namespace MarkdownRow.Edit.CompletionData;

public class FontCompletion : CompletionData
{
    public override void Complete(TextArea textArea, ISegment completionSegment, EventArgs insertionRequestEventArgs)
    {
        textArea.Document.Remove(completionSegment.Offset-1,1);
        textArea.Document.Replace(completionSegment,Text);
        if (Text.Length < 7 && Text.Length % 2 == 0)
        {
            
        }
    }

    public FontCompletion(DocItem item) : base(item)
    {
        var url = new Uri("avares://MarkdownRow/Assets/Image/font.png");
        Image = new Bitmap(AssetLoader.Open(url));
    }
}